package com.example.mydy.model;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * 收益记录模型类
 */
public class IncomeRecord {
    // 收益类型常量
    public static final String TYPE_TASK = "任务收益";     // 任务收益
    public static final String TYPE_REWARD = "悬赏收益";   // 悬赏收益
    public static final String TYPE_DOWNLINE = "下级收益"; // 下级收益

    private String id;
    private String username;
    private double amount;     // 收益金额
    private String type;        // 收益类型
    private String description; // 收益描述
    private long timestamp;     // 创建时间戳
    private String createTime;  // 创建时间字符串
    private String status;      // 已结算、待结算
    private String relatedId;   // 关联ID (任务ID或下级用户ID)

    public IncomeRecord(String id, double amount, String type, String description, long timestamp, String status) {
        this.id = id;
        this.amount = amount;
        this.type = type;
        this.description = description;
        this.timestamp = timestamp;
        this.status = status;
        // 将时间戳转换为字符串格式
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());
        this.createTime = sdf.format(new Date(timestamp));
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getRelatedId() {
        return relatedId;
    }

    public void setRelatedId(String relatedId) {
        this.relatedId = relatedId;
    }

    /**
     * 获取收益类型的文本描述
     * @return 收益类型描述
     */
    public String getTypeText() {
        return type;
    }
} 